package main

import (
	"first/project2/utils"
	"fmt"
	//util "project2/utils"
)

func main() {
	// 包名.方法名
	var result = utils.Cal(1.2, 1, '+')
	fmt.Println(result)
	fmt.Printf("result=%.3f \n", result)
	result1, result2 := getSumAndSub(20, 10)
	fmt.Println(result1, result2)

	_, result3 := getSumAndSub(20, 10)
	fmt.Println(result3)

	result4, result5 := getSumAndSub2(30, 30)
	fmt.Println(result4, result5)

	result6 := sum(10, 20, 30, 40)
	fmt.Println(result6)
}

func getSumAndSub(n1 int, n2 int) (sum int, sub int) {
	return n1 + n2, n1 - n2
}

// 返回值重命名
func getSumAndSub2(n1 int, n2 int) (sum int, sub int) {
	sum = n1 + n2
	sub = n1 - n2
	return
}

func sum(n1 int, args ...int) int {
	sum := n1
	for i := 0; i < len(args); i++ {
		sum += args[i]
	}
	return sum
}
